#ifndef CourtModel_h
#define CourtModel_h

#include "Line.h"
#include "Intersection.h"
#include <iostream>
#include <fstream>
#include <string>

//Wrapper around the Court model used for Fitting.
class CourtModel
{
	std::vector<Line> _courtLines;
	std::vector<cv::Point> _intersectionPoints;
	std::vector<Line> _verticalLines;
	std::vector<Line> _horizontalLines;
	std::vector<Line> _segmentVerticalLines;
	std::vector<Line> _segmentHorizontalLines;

public:
	int rows;
	int cols;
	double courtAspectRatio;
	double courtArea;
	CourtModel(std::string);
	std::vector<Line> getVerLines();
	std::vector<Line> getHorLines();
	std::vector<cv::Point> getIntSecs();
	void drawModel(cv::Mat);
	std::vector<Intersection> _intersections;
	std::vector<Line> allLines;
	CourtModel();
	~CourtModel();
	void readModel(std::string);

	std::vector<Line> getSegmentVerLines();
	std::vector<Line> getSegmentHorLines();


	//Bounding box detection
	std::vector<Line> findBoundingLines();
	Line findMinVertLine(std::vector<Line>);
	Line findMaxVertLine(std::vector<Line>);
	Line findMinHorzLine(std::vector<Line>);
	Line findMaxHorzLine(std::vector<Line>);

private:
	void expandModelLines();
};

#endif
